<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>消费收银</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<!--页面样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_shouyinList.css">
<!--页面样式结束--
<!--公共JS开始-->
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--公共JS结束-->
<!--数据列表插件开始-->
<link href="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.ui.position.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.js"></script>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Css/etgrid.css">
<script src="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Js/etgrid.js"></script>
<!--数据列表插件结束-->
<!--ZTree开始-->
<link rel="stylesheet" href="{$NOW_THEME_URL}/Assets/Plugins/ZTree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Plugins/ZTree/js/jquery.ztree.core-3.5.js"></script>
<!--ztree结束-->
<!--滑动门插件开始-->
<script src="{$NOW_THEME_URL}/Assets/Plugins/EtTab/Js/ettab.js"></script>
<!--滑动门插件结束-->
<style type="text/css">
	body {
		overflow:hidden;
	}
</style>
</head>

<body>
	<div class="yhlist clearfix">
		<div class="yhlist_left">
			<h4 class="yl_title">消费项目</h4>
			<p class="search">
				<input name="" type="text" placeholder="请输入商品条形码">
			</p>
			<div class="mybox">
				<div class="yh_content3" id="tab1_2" fortab="tab1" dosome="false">
					<div class="yh_table">
						<table cellpadding="0" cellspacing="0" class="module_form" width="400">
							<thead>
								<tr>
									<th class="ele_title">商品名称</th>
									<th class="ele_dj">编号</th>
									<th class="ele_dj">单价</th>
									<!-- <th class="ele_kc">库存</th> -->
									<th class="ele_cz">操作</th>
								</tr>
							</thead>
							<tbody class="prolist2">
								<tr>
									<td colspan="4" style="height:58px;"></td>
								</tr>
								<volist name="proList" id="v">
									<tr>
										<td class="ele_title">{$v.ctitle}</td>
										<td class="ele_dj">{$v.pno}</td>
										<td class="ele_kc">￥{$v.sprice}</td>
										<td class="ele_cz">
											<span id="{$v.id}" class="tj timeAdd">添加</span>
										</td>
									</tr>
								</volist>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div class="yhlist_right">
			<div class="table_box" style="border-left:1px solid #999;height:350px;">
				<table cellpadding="0" cellspacing="0" class="module_form" width="400">
					<thead>
						<tr><td colspan="7" style="height:16px">&nbsp;</td></tr>
						<tr>
							<th class="ele_title">名称</th>
							<th class="ele_dj">编号</th>
							<th class="ele_kc">定时</th>
							<th class="ele_kc">开始时间</th>
							<th class="ele_title">备注</th>
							<th class="ele_cz">操作</th>
						</tr>
					</thead>
					<tbody class="prolist2">
						<volist name="timeNow" id="v" offset="0" length="6">
							<tr>
								<td class="ele_title">{$v.title}</td>
								<td class="ele_dj">{$v.pno}</td>
								<td class="ele_kc">{$v.amount}</td>
								<td class="ele_kc">{$v.begin|date="Y-m-d H:i:s",###}</td>
								<td class="ele_kc">{$v.content}</td>
								<td class="ele_cz">
									<span id="{$v.id}" class="dealbtn endTime">计时结束</span>
								</td>
							</tr>
						</volist>
					</tbody>
				</table>
			</div>
			<div class="xiaofei">
				<div class="js clearfix">
					<div>
						<input type="text" name="vipno" id="readCard" class="readCard">
						<a class="form_ele_reset bg_orange">读卡</a>
						<!--  <a class="form_ele_reset bg_remove">清空</a>
						<a class="form_ele_submit bg_payment">结账</a>-->
					</div>
				</div>
				<div class="vip">
					<h4>会员所有的计时消费项目</h4>
					<table cellpadding="0" cellspacing="0" class="module_form" width="400">
					<thead>
						<tr>
							<th class="ele_title">名称</th>
							<th class="ele_dj">编号</th>
							<th class="ele_kc">定时</th>
							<th class="ele_cz">操作</th>
						</tr>
					</thead>
					<tbody class="prolist2">
						<volist name="timeUser" id="v" offset="0" length="6">
							<tr>
								<td class="ele_title">{$v.title}</td>
								<td class="ele_dj">{$v.pno}</td>
								<td class="ele_kc">{$v.amount}</td>
								<td class="ele_cz"><span id="{$v.id}" class="dealbtn startTime">开始计时</span></td>
							</tr>
						</volist>
					</tbody>
				</table>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	function tableShow(){
		var table_box_width = $(window).width() - 364;
		var table_box_height = $(window).height() - 251;
		//alert($(window).width());
		$('.table_box').width(table_box_width);
		$('.table_box').height(table_box_height);
	}
	//初始化调用
	tableShow();
	//窗口改变大小调用
	$(window).on('resize',function(){
		tableShow();
	});
	
	//实例化滑动门
	var tabConfig = {
			tabName: 'tab1',
			tabHeader: '.tab',
			tabContent: '.mybox',
			tabContentFun : {
			}
		};
	//tableList.erefresh();
	//实例化列表
	var memberTab = $('body').EtTab(tabConfig);
	
	//文本框获取焦点
	$('#readCard').focus();
	
	//添加计时消费
	$(".timeAdd").on('click',function(){
		var id = $(this).attr('id');
		
		var href   = "{:U('Sell/timeAdd')}&id="+id;
		var width  = '600px';
		var height = '400px';
		var title  = '开始计时';
		openDialog('Sell_timeAdd',href,width,height,title);
		
	});
	
	//开始计时
	$('.startTime').on('click',function(){
		
		var id = $(this).attr('id');
		$.get("{:U('Sell/startTime')}",{id:id},function(data){
			if(data.status==1){
				windowApi.lhgdialog.alert("计时开始成功",function(){
					var obj = windowApi.lhgdialog.list['Sell_sellTime'];
					obj.reload(obj); //指定刷新某个窗口 
				});
			}else{
				windowApi.lhgdialog.alert(data.info,function(){return;});
			}
		});
	});
	
	//结束计时
	$(".endTime").on("click",function(data){
		
		var obj = $(this);
		var id  = $(this).attr('id');
		
		$.get("{:U('Sell/endTime')}",{id:id},function(data){
			if(data.status==1){
				obj.parents('tr').remove();
				
				var href   = '{:U("Sell/payment")}&orderno='+data.data;
				var width  = '610px';
				var height = '400px';
				var title  = '结账付款';
				openDialog('Sell_payment',href,width,height,title);
			}else{
				windowApi.lhgdialog.alert(data.info,function(){return;});
			}
		});
	});

	//读卡
	$('.bg_orange').on('click',function(){
		
		var vipno = $('#readCard').val();
		if(vipno){
			$.get("{:U('Sell/SellreadCard')}",{vipno:vipno},function(data){
				if(data.status==1){
					var obj = windowApi.lhgdialog.list['Sell_sellTime'];
					obj.reload(obj); //指定刷新某个窗口 
				}else{
					windowApi.lhgdialog.alert(data.info,function(){
						$('#readCard').val('');
						$('#readCard').focus();
						return;
					});
				}
			});
		}else{
			windowApi.lhgdialog.alert("请输入会员卡号",function(){return;});
		}
	});

	//表格隔行换色
	$('.module_form tr:odd').addClass('odd');
	$('.module_form tr:even').addClass('even');
	

	
	//左下列表自适应
	function yhtableShow(){
		var yh_height  =  $(window).height() - 88;
		$('.yh_table').height(yh_height);
	}

	//初始化调用
	yhtableShow();
	//窗口改变大小调用
	$(window).on('resize',function(){
		yhtableShow();
	});
</script>
</html>
